<?php

/**
 * Curso filter form base class.
 *
 * @package    ecampus
 * @subpackage filter
 * @author     Grupo 608
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCursoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'       => new sfWidgetFormFilterInput(),
      'descripcion'  => new sfWidgetFormFilterInput(),
      'activo'       => new sfWidgetFormFilterInput(),
      'codigo_curso' => new sfWidgetFormFilterInput(),
      'id_materia'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Materia'), 'add_empty' => true)),
      'anio'         => new sfWidgetFormFilterInput(),
      'id_docente'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Docente'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'nombre'       => new sfValidatorPass(array('required' => false)),
      'descripcion'  => new sfValidatorPass(array('required' => false)),
      'activo'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'codigo_curso' => new sfValidatorPass(array('required' => false)),
      'id_materia'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Materia'), 'column' => 'id_materia')),
      'anio'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_docente'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Docente'), 'column' => 'id_usuario')),
    ));

    $this->widgetSchema->setNameFormat('curso_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Curso';
  }

  public function getFields()
  {
    return array(
      'id_curso'     => 'Number',
      'nombre'       => 'Text',
      'descripcion'  => 'Text',
      'activo'       => 'Number',
      'codigo_curso' => 'Text',
      'id_materia'   => 'ForeignKey',
      'anio'         => 'Number',
      'id_docente'   => 'ForeignKey',
    );
  }
}
